﻿/* Author - Anshu Dutta - anshu.dutta@gmail.com
 * This source code is governed by terms and condition of Microsoft Public License (Ms-PL). 
 * Copyright (C)  2011 Anshu Dutta. anshu.dutta@gmail.com
 */
using System;
using System.Collections.ObjectModel;
using RssNewsFeeder.Lib.Model.Business;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RssNewsFeeder.Lib.ViewModel
{
    public class NewsItemViewModel:ViewModelBase
    {        
        private NewsItemCollection _newsItemCollection;

        /// <summary>
        /// Constructor
        /// </summary>
        public NewsItemViewModel()
        {
            _newsItemCollection = new NewsItemCollection
            {
                NewsCompany = "BBC",
                NewsType = "Top Stories"
            };
        }
        public NewsItemViewModel(string newsCompany, String newsType)
        {
            _newsItemCollection = new NewsItemCollection
            {
                NewsCompany = newsCompany,
                NewsType = newsType
            };
        }

        public ObservableCollection<NewsItem> NewsItemCollection
        {
            get
            {
                //return new ObservableCollection<NewsItem>(_newsItemCollection.NewsItems);
                ObservableCollection<NewsItem> objColl = new ObservableCollection<NewsItem>();
                foreach (NewsItem item in _newsItemCollection.NewsItems)
                {
                    objColl.Add(item);
                }
                
                return objColl; 
            }
        }
        protected override void OnDispose()
        {
            base.OnDispose();
        }
    }
}
